package com.example.demo;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.security.MessageDigest;

public class TestMD5 {
    public static void main(String[] args) {
        BCryptPasswordEncoder bCryptPasswordEncoder=new BCryptPasswordEncoder();
        System.out.println(bCryptPasswordEncoder.encode("123"));
    }

    public static void main() throws Exception{
        MessageDigest digest=MessageDigest.getInstance("MD5");
        byte[] tmp = digest.digest("123456".getBytes());

        System.out.println("admin---"+ toString(tmp));
    }
    private static String toString(byte[] tmp){

        StringBuilder builder=new StringBuilder("");

        for(byte b:tmp){
            String s=Integer.toHexString(b & 0xFF);
            if(s.length()==1){
                builder.append("0");
            }
            builder.append(s);
        }
        return builder.toString();
    }
}
